package com.groupbuying.cheetah.order.orderManagement.dto;

import com.groupbuying.cheetah.order.orderManagement.domain.OrderUshopDO;
import com.groupbuying.cheetah.utils.apiresult.DateUtils;

import java.math.BigDecimal;

/**
 * 订单表时间格式化
 */
public class OrderUshopDTO extends OrderUshopDO {

    private String gmtCreateStr;
    private String gmtModifiedStr;
    private String closedTimeStr;
    //支付类型:微信-WX-1，支付宝-ALI-2，积分支付-CUR-3，余额支付-BAL-4
    private String payType;

    //实付金额
    private BigDecimal payMoney;
    private BigDecimal payCur;
    private BigDecimal payBalance;

    //实收金额
    private BigDecimal storeAmount;


    public void setGmtModifiedStr(String gmtModifiedStr) {
        this.gmtModifiedStr = gmtModifiedStr;
    }

    public void setClosedTimeStr(String closedTimeStr) {
        this.closedTimeStr = closedTimeStr;
    }
    public void setGmtCreateStr(String gmtCreateStr) {
        this.gmtCreateStr = gmtCreateStr;
    }

    public String getGmtCreateStr() {
        return super.getGmtCreate() == null ? "" : DateUtils.format(super.getGmtCreate(), "yyyy-MM-dd HH:mm:ss");
    }
    public String getClosedTimeStr() {
        return super.getClosedTime() == null ? "" : DateUtils.format(super.getClosedTime(), "yyyy-MM-dd HH:mm:ss");
    }
    public String getGmtModifiedStr() {
        return super.getGmtModified() == null ? "" : DateUtils.format(super.getGmtModified(), "yyyy-MM-dd HH:mm:ss");
    }

    public String getPayType() {
        return payType;
    }

    public void setPayType(String payType) {
        this.payType = payType;
    }

    public BigDecimal getPayMoney()
    {
   if(getPayType().equals("积分支付")){
       payMoney=payCur;
   }
   if(getPayType().equals("余额支付")){
       payMoney=payBalance;
   }
        return payMoney;
    }

    public void setPayMoney(BigDecimal payMoney) {
        this.payMoney = payMoney;
    }

    public BigDecimal getPayCur() {
        return payCur;
    }

    public void setPayCur(BigDecimal payCur) {
        this.payCur = payCur;
    }

    public BigDecimal getPayBalance() {
        return payBalance;
    }

    public void setPayBalance(BigDecimal payBalance) {
        this.payBalance = payBalance;
    }

    public BigDecimal getStoreAmount() {
        return storeAmount;
    }

    public void setStoreAmount(BigDecimal storeAmount) {
        this.storeAmount = storeAmount;
    }

    @Override
    public String toString() {
        return "OrderUshopDTO{" +
                "gmtCreateStr='" + gmtCreateStr + '\'' +
                ", gmtModifiedStr='" + gmtModifiedStr + '\'' +
                ", closedTimeStr='" + closedTimeStr + '\'' +
                ", payType='" + payType + '\'' +
                ", payMoney=" + payMoney +
                ", payCur=" + payCur +
                ", payBalance=" + payBalance +
                ", storeAmount=" + storeAmount +
                '}';
    }
}
